

#ifndef SCREEN_TURBOSCREENCUT_H
#define SCREEN_TURBOSCREENCUT_H

#include <QWidget>
#include <QMenu>
#include "turboscreen.h"
#include "turbomenu.h"
#include "turboshape.h"
#include "turboshapepaint.h"

class TurboScreenCut : public QWidget
{
    Q_OBJECT
public:
    explicit TurboScreenCut(QWidget *parent = nullptr);
    static TurboScreenCut & instance();
    ~TurboScreenCut() override;

    void saveCutScreen();
    void drawPaintbrush();
    void drawEllipse();
    void drawRect();
    void drawMosaic();
    void drawArrow();
    void setCurrentCode(TurboShape::Code code);

protected:
    void showEvent(QShowEvent *event) override;
    void paintEvent(QPaintEvent *event) override;

    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

    void keyPressEvent(QKeyEvent *event) override;

    bool event(QEvent *event) override;

private:
    TurboScreen                   *screen_{nullptr};
    QPixmap                       *blur_pix_{nullptr};        //模糊背景图
    QPixmap                       *full_pix_{nullptr};        //全屏图像
    QPixmap                       mosaic_pix_;
    QPoint                        mov_pos_;          //坐标
    QPoint                        rect_left_pos_;    //坐标
    TurboMenu                     *menu_;
    QList<TurboShape*>            shape_list_;
    TurboShape                    *shape_{nullptr};
    TurboShape::Code              current_code_;
};

#endif //SCREEN_TURBOSCREENCUT_H
